<?php
/**
 * Created by PhpStorm.
 * User: jacob
 * Date: 18-7-27
 * Time: 下午2:28
 */
namespace Tiny;

abstract class API{

  public function process(Request $request,Response $response){
    if ($this->beforeRun($request,$response)){
      $this->run($request,$response);
      $this->afterRun($request,$response);
    }
  }

  protected function beforeRun(Request $request,Response $response){
    return true;
  }
  abstract protected function run(Request $request,Response $response);
  protected function afterRun(Request $request,Response $response){}
}